using System.ComponentModel;
using MySqlConnector;

namespace Front._1127;

public partial class login : Form
{
    public login()
    {
        InitializeComponent();
    }

    private void login_Load(object sender, EventArgs e)
    {
        using var connection = new MySqlConnection("server=localhost;port=3306;database=book;user=root;password=WDH2286135890;charset=utf8mb4;AllowPublicKeyRetrieval=True;");
        connection.Open();

        using var command = new MySqlCommand("SELECT * FROM admin_info;", connection);
        using var reader = command.ExecuteReader();
        while (reader.Read())
            Console.WriteLine(reader.GetInt32(0));
    
    }
        if (reader.hasrows)
    {
        MainForm mainForm = new MainForm();
        mainForm.Show()
            this.Hide();
    }
    else
    {
        MessageBox.Show("账号或密码错误");
        this.textBox1.Text = "";
        
    }
    private void button1_Click(object sender, EventArgs e)
    {
        throw new System.NotImplementedException();
    }
}